package com.yjh.admin.server.chronic.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yjh.admin.dto.chronic.EquipmentUserDto;
import com.yjh.admin.entity.chronic.EquipmentUser;
import com.yjh.admin.mapper.chronic.EquipmentUserMapper;
import com.yjh.admin.server.chronic.EquipmentUserService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
 * 用户设备关联表
 *
 * @author GuoBin
 * @date 2020-08-06 16:14:41
 */
@Service
public class EquipmentUserServiceImpl extends ServiceImpl<EquipmentUserMapper, EquipmentUser> implements EquipmentUserService {
    @Override
    public List<EquipmentUserDto> queryEquipmentUserList(Integer vipId) {
        List<EquipmentUserDto> equipmentUserDto =  baseMapper.queryEquipmentUserList(vipId,1);
        for(EquipmentUserDto dto:equipmentUserDto){
            if(Objects.isNull(dto.getStatus())){
                dto.setStatus("0");
            }
        }
        return equipmentUserDto;
    }

    @Override
    public List<EquipmentUserDto> queryUserEquipmentList(Integer vipId) {
        return baseMapper.queryUserEquipmentList(vipId);
    }
}
